package adv329;

import java.util.Calendar;

/**
 * @author oldliu
 * @since 1.0
 */
public class CalTest5 {
    public static void main(String[] args) {
        Calendar c=Calendar.getInstance();
        //>>>System.out.println(c.getActualMaximum(Calendar.YEAR));
//        int s = c.getActualMaximum(Calendar.DAY_OF_MONTH);
//        System.out.println("本月有"+s+"天");
//         s = c.getActualMaximum(Calendar.DAY_OF_YEAR);
//        System.out.println("本年有"+s+"天");
//        System.out.println(">>>>>>>>>>>>>");
        int year=c.get(Calendar.YEAR);
        c.set(year,Calendar.JANUARY,1);//本年的一月一号
        int w=0;
        int week=c.get(Calendar.DAY_OF_WEEK);
        if(week!=Calendar.SUNDAY)
            w=7+1-c.get(Calendar.DAY_OF_WEEK);
        c.add(Calendar.DATE,w);

        //System.out.println("本年的第一个周日："+c.getTime());
        while (c.get(Calendar.YEAR)==year){
            System.out.println("周日："+c.getTime());
            c.add(Calendar.DATE,7);
        }
    }
}
